package com.medusa.aps.business.modules.modeling.model.input;

import cn.hutool.core.annotation.Alias;
import cn.hutool.core.util.StrUtil;
import com.medusa.aps.business.model.pagination.Page;
import com.medusa.aps.business.modules.modeling.mp.entity.Equipment;
import com.medusa.aps.business.global.model.o.RangeDate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class EquipmentParam extends Page<Equipment> {


    /**
     * 设备编码
     */
    @Schema(description = "设备编码")
    private String equipmentNumber;

    /**
     * 设备名称
     */
    @Schema(description = "设备名称")
    private String deviceName;

    /**
     * 创建人
     */
    @Alias("创建人")
    @Schema(description = "创建人")
    private String creator;


    /**
     * 所属车间
     */
    @Schema(description = "所属车间")
    private String workshopName;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    private RangeDate createTime = new RangeDate();

    /**
     * 设备id
     */
    @Schema(description = "设备id")
    private List<Long> ids;
    /**
     * 设备编码集合
     */
    private List<String> equipmentNumbers;

    @SuppressWarnings(value = "unused")
    public void setEquipmentNumber(String equipmentNumber) {
        if (StrUtil.isEmpty(equipmentNumber) || !equipmentNumber.contains(StrUtil.COMMA)) {
            this.equipmentNumber = equipmentNumber;
            return;
        }
        this.equipmentNumbers = StrUtil.split(equipmentNumber, StrUtil.COMMA);
    }
}
